<?php use app\models\Meta;
use yii\helpers\Url;

$banners = Meta::getBanners(); ?>
<?php if($banners): ?>
<div class="carousel">
    <div class="carousel-bg" style="background-image: url('<?= $banners[array_rand($banners)]['description'];?>');"></div>
    <div class="carousel-body container grid-xl">
        <?php foreach ($banners as $i => $banner): ?>
            <?php if($i === 0 || $i == 3): ?>
                <div class="columns">
            <?php endif; ?>
            <div class="column">
                <a href="<?= Url::to(['comic/detail', 'id' => $banner['sort']]); ?>"><img src="<?= $banner['description']; ?>" class="img-responsive"></a>
            </div>
            <?php if($i == 2 || $i === 5): ?>
                </div>
            <?php endif; ?>
        <?php endforeach; ?>
    </div>
</div>
<?php endif; ?>